package com.cssiot.webApi.config;

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.Ordered;
import org.springframework.core.env.Environment;

@ConfigurationProperties(prefix = "server", ignoreUnknownFields = true)  
public class ServerProperties  
        implements EmbeddedServletContainerCustomizer, EnvironmentAware, Ordered {  
  
    /** 
     * Server HTTP port. 
     */  
    private Integer port;
    
    

	public Integer getPort() {
		return port;
	}

	public void setPort(Integer port) {
		this.port = port;
	}

	@Override
	public int getOrder() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void setEnvironment(Environment environment) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void customize(ConfigurableEmbeddedServletContainer container) {
		if (getPort() != null) {  
	        container.setPort(getPort());  
	    }  
		
	} 
    
}